/*
 *  @author                   安帅
 *  @date                       2020-06-15
 *  @date_latest         2020-06-15
 *  @email                     1028792866@qq.com
 *  @descp                        时间窗口类源文件
 */

#include  "time_dialog.h"
#include <QTime>

QTTRAINING_NAMESPACE_BEGIN

TimeDialog::TimeDialog()
{
    _p_button_time = new QPushButton("获取当前时间",this);
    _p_button_time->setGeometry(150,200,100,50);
    _p_button_time->setStyleSheet("background-color:rgba(255,0,0,0.5)");

    _p_label_time = new QLabel("时间显示区域",this);
    _p_label_time->setGeometry(150,100,100,50);
    _p_label_time->setStyleSheet("background-color:rgba(0,255,0,0.5)");
    _p_label_time->setAlignment(Qt::AlignCenter);

    connect(_p_button_time, SIGNAL(clicked()),
       this, SLOT(timeClicked()) );
}

TimeDialog::~TimeDialog()
{
}

void TimeDialog::timeClicked(void)
{
    _p_label_time->setText(QTime::currentTime().toString("hh::mm::ss"));
}

QTTRAINING_NAMESPACE_END